import java.applet.Applet;
import java.applet.AudioClip;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;

import javax.print.DocFlavor.URL;
import javax.sound.sampled.AudioFormat;
import javax.sound.sampled.AudioInputStream;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.Clip;
import javax.sound.sampled.DataLine;
import javax.sound.sampled.FloatControl;
import javax.sound.sampled.LineUnavailableException;
import javax.sound.sampled.SourceDataLine;
import javax.sound.sampled.UnsupportedAudioFileException;

public class sfx extends Thread{
	
	public void play(int iSoundfile) throws UnsupportedAudioFileException, IOException, LineUnavailableException 
	{	
		String sSoundfile = "";   
		switch (iSoundfile) {
		case 1: sSoundfile = "Intro.wav"; break;
		case 2: sSoundfile = "GenerierenDice.wav"; break;
		case 3: sSoundfile = "Fertig.wav"; break;
		case 4: sSoundfile = "Legendaer.wav"; break;
		case 5: sSoundfile = "byebye.wav"; break;
		
		default: sSoundfile = "Intro.wav"; break;
		}

		AudioInputStream myImputStream = AudioSystem.getAudioInputStream(new File(".\\src\\sfx\\"+sSoundfile));
		AudioFormat myAudioFormat = myImputStream.getFormat();
	
		int iWavSize = (int) (myAudioFormat.getFrameSize()* myImputStream.getFrameLength());
		byte[] bASound = new byte[iWavSize];
		DataLine.Info myInfo = new DataLine.Info(Clip.class, myAudioFormat, iWavSize);
		myImputStream.read(bASound, 0, iWavSize);
	
		Clip myClip = (Clip) AudioSystem.getLine(myInfo);
		myClip.open(myAudioFormat, bASound, 0, iWavSize);
		myClip.start();
	
	
		for (int i = 0; i < 3000000; i++) 
		{
					
		}
	
	}
	
	/*public static void main(String[] args) throws UnsupportedAudioFileException, IOException, LineUnavailableException 
	{

	}*/
}
